#include <STC15F2K60S2.H>
#include "juzhen.h"
#include "smg.h"

#define uchar unsigned char

uchar keynum;

void main()
{
	P2 = 0xA0; P0 = 0x00; P2 = 0xC0; P0 = 0xFF;	P2 = 0xFF;	//初始化,P0控制数码管
	
	while(1)
	{
		keynum = KeyJZ_16();
		
		if     (keynum == 7)	P0 = tab[1];
		else if (keynum == 11)	P0 = tab[2];
		else if (keynum == 15)	P0 = tab[3];
		else if (keynum == 19)	P0 = tab[4];
		else if (keynum == 6)	P0 = tab[5];
		else if (keynum == 10)	P0 = tab[6];
		else if (keynum == 14)	P0 = tab[7];
		else if (keynum == 18)	P0 = tab[8];
		else if (keynum == 5)	P0 = tab[9];
		else if (keynum == 9)	P0 = tab[0];
		else if (keynum == 13)	P0 = tab[10];
		else if (keynum == 17)	P0 = tab[11];
		else if (keynum == 4)	P0 = tab[12];
		else if (keynum == 8)	P0 = tab[13];
		else if (keynum == 12)	P0 = tab[14];
		else if (keynum == 16)	P0 = tab[15];	
	}
}
